import { http } from '@/utils/https'
//登陆
type loginParams = {
  code: string
  encryptedData: string
  iv: string
}
export const wxLoginApi = (data: loginParams) => {
  return http({
    method: 'POST',
    url: '/login/wxMin',
    data,
  })
}

// 模拟登陆
export const wxLoginApi_Test = (data: any) => {
  return http({
    method: 'POST',
    url: '/login/wxMin/simple',
    data,
  })
}

// 获取用户信息
export const getUserInfoApi = (data: any) => {
  return http({
    method: 'GET',
    url: '/member/profile',
    data,
  })
}

// 修改用户信息
export const updateUserInfoApi = (data: any) => {
  return http({
    method: 'PUT',
    url: '/member/profile',
    data,
  })
}

// 地址列表
export const getAddressListApi = (data: any) => {
  return http({
    method: 'GET',
    url: '/member/address',
    data,
  })
}

// 地址详情
export const getAddressDetailApi = (id: string, data: any) => {
  return http({
    method: 'GET',
    url: `/member/address/${id}`,
    data,
  })
}

// 添加地址
export const addAddressApi = (data: any) => {
  return http({
    method: 'POST',
    url: '/member/address',
    data,
  })
}

// 修改地址
export const updateAddressApi = (id: string, data: any) => {
  return http({
    method: 'PUT',
    url: `/member/address/${id}`,
    data,
  })
}

// 删除地址 /member/address/{id}
export const deleteAddressApi = (id: string, data: any) => {
  return http({
    method: 'DELETE',
    url: `/member/address/${id}`,
    data,
  })
}
